package com.zzh.lib.core.model;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * Created by Vincent Woo
 * Date: 2016/10/10
 * Time: 17:44
 */

public class HImageFileModel extends HFileModel implements Parcelable {
    private int orientation;   //0, 90, 180, 270
    private String displayName;
    private String author;

    public int getOrientation() {
        return orientation;
    }

    public HImageFileModel setOrientation(int orientation) {
        this.orientation = orientation;
        return this;
    }

    public String getDisplayName() {
        return displayName == null ? "" : displayName;
    }

    public HImageFileModel setDisplayName(String displayName) {
        this.displayName = displayName;
        return this;
    }

    public String getAuthor() {
        return author == null ? "" : author;
    }

    public HImageFileModel setAuthor(String author) {
        this.author = author;
        return this;
    }

    public HImageFileModel() {
    }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        super.writeToParcel(dest, flags);
        dest.writeInt(this.orientation);
        dest.writeString(this.displayName);
        dest.writeString(this.author);
    }

    public void readFromParcel(Parcel source) {
        super.readFromParcel(source);
        this.orientation = source.readInt();
        this.displayName = source.readString();
        this.author = source.readString();
    }

    protected HImageFileModel(Parcel in) {
        super(in);
        this.orientation = in.readInt();
        this.displayName = in.readString();
        this.author = in.readString();
    }

    public static final Creator<HImageFileModel> CREATOR = new Creator<HImageFileModel>() {
        @Override
        public HImageFileModel createFromParcel(Parcel source) {
            return new HImageFileModel(source);
        }

        @Override
        public HImageFileModel[] newArray(int size) {
            return new HImageFileModel[size];
        }
    };

    @Override
    public String toString() {
        return "HImageFileModel{" +
                "orientation=" + orientation +
                ", displayName='" + displayName + '\'' +
                ", author='" + author + '\'' +
                "} " + super.toString();
    }
}
